package com.memo4android;

import java.util.Calendar;
import java.util.Date;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.GridView;

import com.memo4android.model.AppModel;
import com.memo4android.model.FaibleAdapter;
import com.memo4android.model.ItemTodoList;


public class FaibleActivity extends Activity implements OnClickListener{
	
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
        setContentView(R.layout.frame_todos);
     
        
        AppModel model = AppModel.getInstance(this);
        if (getIntent().getExtras()!=null){
        	this.setTitle(getIntent().getExtras().getString("label"));
        }
        setTitle(this.getTitle() + " - " + "TodoLists faible");
        ((Button)this.findViewById(R.id.button_ajouter_icone)).setOnClickListener((android.view.View.OnClickListener) this);
        ((Button)this.findViewById(R.id.button_allnotes)).setOnClickListener((android.view.View.OnClickListener) this);
        ((Button)this.findViewById(R.id.button_alltodos)).setOnClickListener((android.view.View.OnClickListener) this);
        ((Button)this.findViewById(R.id.button_important)).setOnClickListener((android.view.View.OnClickListener) this);
        ((Button)this.findViewById(R.id.button_moyen)).setOnClickListener((android.view.View.OnClickListener) this);
        ((Button)this.findViewById(R.id.button_faible)).setOnClickListener((android.view.View.OnClickListener) this);
        GridView gridview = (GridView) findViewById(R.id.tableau_memo);
		gridview.setAdapter(new FaibleAdapter(this));
		
	}
    public void onBackPressed(){
    	
		Intent intent = new Intent(this ,ToDoListsActivity.class);
		this.startActivity(intent);  
	
}	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch(v.getId()){
		case R.id.button_ajouter_icone:
			Intent intent_newtodo = new Intent(this ,NewTodoActivity.class);
			this.startActivity(intent_newtodo);
			break;
	
		case R.id.button_allnotes:
			Intent intent = new Intent(this ,MainView.class);
			this.startActivity(intent);
			break;
		case R.id.button_alltodos:
			Intent intent_alltodos = new Intent(this ,ToDoListsActivity.class);
			this.startActivity(intent_alltodos);
			break;
		case R.id.button_important:
			Intent intent_important = new Intent(this, ImportantActivity.class);
			this.startActivity(intent_important);
			break;
		case R.id.button_moyen:
			Intent intent_moyen = new Intent(this, MoyenneActivity.class);
			this.startActivity(intent_moyen);
			break; 
		case R.id.button_faible:
			Intent intent_faible = new Intent(this, FaibleActivity.class);
			this.startActivity(intent_faible);
			break;
		}
		
	}

}
